package com.godfrey.mapper;

import com.godfrey.pojo.User;
import org.apache.ibatis.annotations.*;

/**
 * description : 持久层接口
 *
 * @author godfrey
 * @since 2020-05-18
 */
public interface UserMapper {

    //根据id查询用户
    @Select("select * from user where id = #{id}")
    User selectUserById(@Param("id") int id);

    //添加一个用户
    @Insert("insert into user (id,name,pwd) values (#{id},#{name},#{pwd})")
    int addUser(User user);

    //修改一个用户
    @Update("update user set name=#{name},pwd=#{pwd} where id = #{id}")
    int updateUser(User user);

    //根据id删除用
    @Delete("delete from user where id = #{id}")
    int deleteUser(@Param("id") int id);
}